/*
 * 1478. 简单计算器
 * 给出两个整数 a , b ,以及一个操作符 opeator
 * +, -, *, /
 * 返回结果 a<operator>b
 * https://www.lintcode.com/problem/simple-calculator/description
 * 
 * 样例
 * For a = 1, b = 2, operator = +, return 3.
 * For a = 10, b = 20, operator = *, return 200.
 * For a = 3, b = 2, operator = /, return 1. (not 1.5)
 * For a = 10, b = 11, operator = -, return -1.
 * 
 * 2018.06.10 @jeyming
 */
package simple_calculator_1478;

public class Simple_calculator_1478 {
    /**
     * @param a: An integer
     * @param operator: A character, +, -, *, /.
     * @param b: An integer
     * @return: The result
     */
    public static int calculate(int a, char operator, int b) {
        // write your code here
    	switch(operator) {
    	case '+':
    		return a + b;
    	case '-':
    		return a - b;
    	case '*':
    		return a * b;
    	case '/':
    		return a / b;
    	}
		return b;
    }

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		System.out.println(calculate(1,'+',2));
		System.out.println(calculate(10,'*',20));
		System.out.println(calculate(3,'/',2));
		System.out.println(calculate(10,'-',11));
	}

}
